package com.hyjx.framework.common.tags;

import com.hyjx.framework.service.SystemService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import java.io.IOException;

/**
 * 主题标签
 */
public class ThemeTag extends TagSupport {
	private static final long serialVersionUID = 1L;

	private String id;//唯一标示
	private String clzzName;//关联的model实体
	private String url;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getClzzName() {
		return clzzName;
	}

	public void setClzzName(String clzzName) {
		this.clzzName = clzzName;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public int doStartTag() {
		HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
		String theme = SystemService.getCurrentTheme(request);
		JspWriter out = pageContext.getOut();
		try {
			out.print(theme);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return SKIP_BODY;
	}
}